package com.hsj.goldstore.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.hsj.goldstore.R;
import com.hsj.goldstore.bean.GoodsBean;
import com.hsj.goldstore.bean.LoginBean;
import com.hsj.goldstore.mvp.view.MyCouponView;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2018/3/26.
 */

public class MyCouponAdapter extends RecyclerView.Adapter<MyCouponAdapter.MyCouponViewHolder> {
    private List<GoodsBean> list = new ArrayList<>();
    private Context context;

    public MyCouponAdapter(Context context, List<GoodsBean> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public MyCouponViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        MyCouponViewHolder holder = new MyCouponViewHolder(LayoutInflater.from(context)
                .inflate(R.layout.item_coupon, parent, false));
        return holder;
    }

    @Override
    public void onBindViewHolder(MyCouponViewHolder holder, int position) {
        holder.tvName.setText(list.get(position).getGoodsName());
        holder.tvTime.setText(list.get(position).getTime());

   }

    @Override
    public int getItemCount() {
        return list.size() + 10;
    }

    class MyCouponViewHolder extends RecyclerView.ViewHolder {
            TextView tvName, tvTime, tvLimit;

            public MyCouponViewHolder(View itemView) {
                super(itemView);
                tvName = itemView.findViewById(R.id.tv_name);
                tvTime = itemView.findViewById(R.id.tv_time);
                tvLimit = itemView.findViewById(R.id.tv_limit);
            }
    }


}
